package com.king.designpatterns.hybriddesignpattern.hybriddesignpattern.specificationpattern;

/**
 * 抽象组合规格书
 *
 * @author king
 * @date 2021-06-16 16:30
 */
public abstract class CompositeSpecification implements IUserSpecification{
    @Override
    public abstract boolean isSatisfiedBy(User user);

    @Override
    public IUserSpecification and(IUserSpecification spec) {
        return new AndSpecification(this, spec);
    }

    @Override
    public IUserSpecification or(IUserSpecification spec) {
        return new OrSpecification(this, spec);
    }

    @Override
    public IUserSpecification not() {
        return new NotSpecification(this);
    }
}
